/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kmcsoft.goldshop.model.scm;

import com.kmcsoft.emaster.entity.TrackableEntity;
import com.kmcsoft.goldshop.model.master.Booth;
import com.kmcsoft.goldshop.model.master.Shop;
import java.util.ArrayList;
import java.util.List;
import javax.jdo.annotations.FetchGroup;
import javax.jdo.annotations.FetchGroups;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

/**
 *
 * @author kmcsoft02
 */
@PersistenceCapable(detachable = "true", table = "SHOP_ImportJewerlyOrder")
@FetchGroups(value = {
    @FetchGroup(name = "detach_ImportJewerlyOrder_All", members = {
        @Persistent(name = "shop"),
        @Persistent(name = "booth"),
        @Persistent(name = "details")}),
    @FetchGroup(name = "detach_ImportJewerlyOrder_Shop", members = {
        @Persistent(name = "shop")}),
    @FetchGroup(name = "detach_ImportJewerlyOrder_Booth", members = {
        @Persistent(name = "booth")}),
    @FetchGroup(name = "detach_ImportJewerlyOrder_ImportJewelryDetail", members = {
        @Persistent(name = "details")})
})
public class ImportJewerlyOrder extends TrackableEntity {

    public static int TYPE_JEWELRY = 1;
    public static int TYPE_PREMIUM_JEWELRY = 2;
    public static int TYPE_DIAMOND = 3;
    @Persistent
    private Shop shop;
    @Persistent
    private Booth booth;
    @Persistent
    private int type;
    @Persistent
    private int code;
    @Persistent(mappedBy = "order")
    private List<ImportJewelryDetail> details;
    @Persistent
    private boolean closed;
    @Persistent
    private String note;

    public ImportJewerlyOrder() {
        details = new ArrayList<ImportJewelryDetail>();
    }

    public Shop getShop() {
        return shop;
    }

    public void setShop(Shop shop) {
        this.shop = shop;
    }

    public Booth getBooth() {
        return booth;
    }

    public void setBooth(Booth booth) {
        this.booth = booth;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public List<ImportJewelryDetail> getDetails() {
        return details;
    }

    public void setDetails(List<ImportJewelryDetail> details) {
        this.details = details;
    }

    public boolean isClosed() {
        return closed;
    }

    public void setClosed(boolean closed) {
        this.closed = closed;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public boolean isUsed() {
        if (getId() == 0) {
            return false;
        }
        return true;

    }
}
